<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">

<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
	<!-- CSRF Token -->
	<meta name="csrf-token" content="{{ csrf_token() }}">
	<meta name="_token" content="{!! csrf_token() !!}" />

	<title>像素小站</title>

	<!-- Styles -->
	<link href="{{ asset('css/app.css') }}" rel="stylesheet">
	<!-- <link href="https://cdn.bootcss.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"> -->
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
	<link href="{{ asset('css/common.css') }}" rel="stylesheet">
	<link rel="shortcut icon" type="image/x-icon" href="/lv5/public/favicon.ico">
</head>

<body style="background-color: #ffffff;">
	<div id="app">
		<nav class="navbar navbar-default navbar-static-top">
			<div class="container">
				<div class="navbar-header">
					<!-- Collapsed Hamburger -->
					<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#app-navbar-collapse">
						<span class="sr-only">Toggle Navigation</span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
						<span class="icon-bar"></span>
					</button>
					<div style="vertical-align: middle; height:54px;">
						<!-- Branding Image -->
						<a class="navbar-brand" href="https://www.fxpixels.site/lv5/public/index.php" style="line-height: 32px;">
							<img src="/lv5/public/img/t_logo.png" alt="" style="transform:translateX(-20px); padding-bottom:8px; margin-right:12px; width:29px; display:inline-block">
							<span></span>
						</a>
						<a class="navbar-brand" href="{{ url('https://www.fxpixels.site/lv5/public/index.php/home') }}" style="line-height: 35px; padding-top: 12px; margin-left:10px; display:inline-block">
							首页
						</a>
						<a class="navbar-brand" href="{{ url('paper/create') }}" style="line-height: 35px; padding-top: 12px; margin-left: -4px; display:inline-block">
							投稿
						</a>
						<a class="navbar-brand" href="{{ url('https://www.fxpixels.site/lv5/public/index.php/home') }}" style="line-height: 35px; padding-top: 12px; margin-left: -4px; display:inline-block">
							关于
						</a>
						<div id="search-input" class="col-md-3 col-xs-3 popover-options" style="top:10px;">
							<div class="input-group">
								<input type="text" class="form-control" data-placement="bottom" data-title="" data-container="body" data-toggle="popover"
								  data-content='
                                        <p>
                                            <span>热词搜索</span>
                                            <span style="margin-left:120px;"><a href="">换一批 <i class="fa fa-refresh" aria-hidden="true"></a></i></span>
                                        </p>
                                        <p class="search-c"><span class="search-category" >尚未支持热词……</span></p>
                                        <p class="search-c"><span class="search-category">向往的生活</span></p>
                                        <p class="search-c"><span class="search-category">摄影</span></p>
                                        <p class="search-c"><span class="search-category">你的未来</span></p>
                                        <hr>
                                        <p>
                                            <span>历史搜索</span>
                                        </p>
                                        <p>不知道搜了啥xxxxxxxxxxxxxxx…</p>
                                        <p>不知道搜了啥xxxxxxxxxx…</p>
                                        '>
								<span class="input-group-btn">
									<button class="btn btn-default" type="button">
										<i class="fa fa-search" aria-hidden="true"></i>
									</button>
								</span>
							</div>
							<!-- /input-group -->
						</div>
						<!-- /.col-lg-6 -->
						<div class="collapse navbar-collapse" id="app-navbar-collapse">
							<!-- Right Side Of Navbar -->
							<ul class="nav navbar-nav navbar-right">
								<!-- Authentication Links -->
								@if (Auth::guest())
								<li>
									<a href="{{ route('login') }}">登录</a>
								</li>
								<li>
									<a href="{{ route('register') }}">注册</a>
								</li>
								@else
								<li class="dropdown">
									<a href="#" style="padding-top: 18px;" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
										<span class="">未读消息</span>&nbsp;
										<span id="notification_count" class="badge">0</span>&nbsp;
									</a>

									<ul id="notifications" class="dropdown-menu" role="menu">
									</ul>
								</li>
								<li class="dropdown">
									<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
										<img style="margin-right:5px; width:32px; height:32px; border-radius: 16px;" src="/lv5/public/img/user/{{ Auth::user()->avatar }}"
										  alt=""> {{ Auth::user()->name }}
										<span class="caret"></span>
									</a>

									<ul class="dropdown-menu" role="menu">
										@if (Auth::user()->groupm == 'administrator')
										<li>
											<a href="{{ url('/admin') }}">后台管理面板</a>
										</li>
										@endif
										<li>
											<a href="{{ url('setting') }}"><i class="fa fa-cog" aria-hidden="true"></i> 设置</a>
										</li>
										<li role="presentation" class="divider"></li>
										<li>
												<?php session(['new_id'=>Auth::user()->id]) ?>
											<a href="{{ url('article') }}"><i class="fa fa-user" aria-hidden="true"></i> 个人主页</a>
										</li>
										<li>
											<a href="{{ url('article/create') }}"><i class="fa fa-file-text-o" aria-hidden="true"></i> 写文章</a>
										</li>
										<li role="presentation" class="divider"></li>
										<li>
											<a href="{{ url('category/user').'?user='.Auth::user()->id }}"><i class="fa fa-bars" aria-hidden="true"></i> 我创建的专题</a>
										</li>
										<li>
											<a href="{{ url('category/create') }}"><i class="fa fa-bookmark-o" aria-hidden="true"></i> 创建专题</a>
										</li>
										<li role="presentation" class="divider"></li>
										<li>
											<a href="{{ route('logout') }}" onclick="event.preventDefault();
																											 document.getElementById('logout-form').submit();">
																											 <i class="fa fa-sign-out" aria-hidden="true"></i> 退出
											</a>

											<form id="logout-form" action="{{ route('logout') }}" method="POST" style="display: none;">
												{{ csrf_field() }}
											</form>
										</li>
									</ul>
								</li>

								@endif
							</ul>
						</div>
					</div>
				</div>

			</div>
		</nav>

		@yield('content')
	</div>

	<!-- Scripts -->
	<!-- <script src="{{ asset('js/app.js') }}"></script> -->
	<script src="https://cdn.bootcss.com/jquery/2.2.2/jquery.js"></script>
	<script src="https://cdn.bootcss.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
	<script>
		$(document).ready(function () {
			$.ajaxSetup({
				headers: {
					'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
				}
			});


			$.ajax({
				type: 'POST',
				url: "https://www.fxpixels.site/lv5/public/index.php/home/gnotification",
				async: false,
				contentType: 'application/json',
				processData: true,
				datatype: "json",
				success: function (data) {
					// console.log(data);
					if (data.length != 0) {
						$('#notification_count').text(data.length);
						var dl = data.length;
						if (dl > 5) {
							dl = 5;
						}
						var notification = '';
						var i;
						for (i = 0; i < dl; i++) {
							notification += '<li style="padding-top:5px;">&nbsp;&nbsp;&nbsp;' +
								data[i].category_name +
								'-增加了<a style="padding-left: 10px;" href="https://www.fxpixels.site/lv5/public/index.php/article/' +
								data[i].article_id + '">《' + data[i].article_title + '》</a>';
						}
						notification = notification +
							'</li><li role="presentation" class="divider"></li><li style="text-align: center;"><a href="https://www.fxpixels.site/lv5/public/index.php/notification/index">查看历史</a></li>';
						$('#notifications').html(notification);
					} else {
						var notification =
							'<li><span style="padding-left:10px;">暂无更多…</span></li><li role="presentation" class="divider"></li><li style="text-align: center;"><a href="https://www.fxpixels.site/lv5/public/index.php/notification">查看历史</a></li>';
						$('#notifications').html(notification);
					}
				},
				error: function (XMLHttpRequest, textStatus, errorThrown) {
					console.log('XMLHttpRequest.status=' + XMLHttpRequest.status);
					console.log('XMLHttpRequest.readyState=' + XMLHttpRequest.readyState);
					console.log('atextStatus=' + textStatus);
				}
			});

			$(".popover-options input").focus(function (event) {
				$(".popover-options input").popover({
					html: true
				});
				event.stopPropagation();
				return false;
			});
		});
	</script>
	<script src="/lv5/public/js/common.js"></script>
	<script src="/lv5/public/js/show.js"></script>
	@if (Request::getRequestUri() == '/lv5/public/index.php/home')
	<script src="/lv5/public/js/lazy_load.js"></script>
	@endif
	<script src="/lv5/public/js/user_paper.js"></script>
</body>

</html>